package com.example.test.主方法运行测试;

public class HuiWenNum {


    public static boolean huiWen(int n) {
        String str = String.valueOf(n);
        int length = str.length();
        int a = 0;
        for (int i = 0; i < length / 2; i++) {
            if (str.charAt(i) == str.charAt(length - i - 1)) {// 前一半后一半相等
                a++;
            }
        }
        return a == str.length() / 2;
    }


    public static void main(String[] args) {
        int num = 838;
        for (int i = num + 1; i < Integer.MAX_VALUE; i++) {
            if (huiWen(i)) {
                System.out.println(i);
                break;
            }
        }
    }
}
